var app =new Vue({
    el:"#container",
    data:{
        pageNum:1,
        pageSize:3,
        pageInfo:[],
        icNumber:""
    },
    mounted:function (){
        this.getPage(this.pageNum,this.pageSize);
    },
    methods:{
        getPage:function (pageNum,pageSize,icNumber){
            var data=new URLSearchParams();
            data.append("pageNum",pageNum);
            data.append("pageSize",pageSize);
            data.append("icNumber",icNumber);
            axios({
                method: "post",
                url:"yly-api/admin/queryAllIcCard",
                data:data,
                headers:{"token":localStorage.token,"url":window.location.pathname}
            }).then(function (res){
                console.log(res.data);
                if (res.data.code==200){
                    app.pageInfo=res.data.data;
                    app.pageNum=res.data.data.pageNum;
                    app.pageSize=res.data.data.pageSize;
                }else if (res.data.code==500){
                    location.href="500.html";
                }
            }).catch(function (error){
                console.log(error.response.status);
                if (error.response.status==401){
                    alert("请先登录!");
                    location.href="login.html";
                }else if (error.response.status==403){
                    alert("用户已过期，请重新登录！");
                    localStorage.token=null;
                    location.href="login.html";
                }
            })
        },
        firstPage:function () {
            this.getPage(this.pageInfo.navigateFirstPage,this.pageSize,this.icNumber);
        },
        lastPage:function (){
            this.getPage(this.pageInfo.navigateLastPage,this.pageSize,this.icNumber);
        },
        number:function (page) {
            this.getPage(page,this.pageSize,this.icNumber);
        },
        query:function (){
            this.getPage(this.pageInfo.navigateFirstPage,this.pageSize,this.icNumber);
        }
    }
});
